home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / system-tools-backends.preinst < prev    next >
Encoding:
Text File  |  2011-09-23  |  2.3 KB  |  59 lines

  1. #!/bin/sh
  2. set -e
  3.  
  4. # stop backend here when upgrading from a version that didn't handle
  5. # it correctly yet in the prerm
  6.  
  7. # Remove a no-longer used conffile
  8. rm_conffile() {
  9.     PKGNAME="$1"
  10.     CONFFILE="$2"
  11.  
  12.     if [ -e "$CONFFILE" ]; then
  13.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  14.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  15.         if [ "$md5sum" != "$old_md5sum" ]; then
  16.             echo "Obsolete conffile $CONFFILE has been modified by you."
  17.             echo "Saving as $CONFFILE.dpkg-bak ..."
  18.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  19.         else
  20.             echo "Removing obsolete conffile $CONFFILE ..."
  21.             rm -f "$CONFFILE"
  22.         fi
  23.     fi
  24. }
  25. case "$1" in
  26.     install|upgrade)
  27.         if dpkg --compare-versions "$2" lt-nl 2.2.1-5; then
  28.             test -x /etc/dbus-1/event.d/70system-tools-backends && \
  29.                 /etc/dbus-1/event.d/70system-tools-backends stop || true
  30.             rm_conffile system-tools-backends "/etc/dbus-1/event.d/70system-tools-backends"
  31.         fi
  32.         if dpkg --compare-versions "$2" lt-nl 2.6.0-3; then
  33.             rm_conffile system-tools-backends "/etc/init.d/system-tools-backends"
  34.             update-rc.d system-tools-backends remove
  35.         fi
  36.         if [ -f /etc/dbus-1/system.d/system-tools-backends.conf ] && \
  37.            [ -f /etc/dbus-1/system.d/org.freedesktop.SystemToolsBackends.conf ]; then
  38.             # We have both old and new conffiles, which probably means that a version
  39.             # between 2.6.0-6.1 and 2.10.1-2 was installed.
  40.             if echo "68224c4af00f723e7e08992a91ddc9f286fc4f4c  /etc/dbus-1/system.d/system-tools-backends.conf" |
  41.                sha1sum --check --status -; then
  42.                 # Old conffile was not modified, let's just remove it
  43.                 rm -f /etc/dbus-1/system.d/system-tools-backends.conf
  44.             else
  45.                 # Otherwise, rename it
  46.                 mv /etc/dbus-1/system.d/system-tools-backends.conf \
  47.                         /etc/dbus-1/system.d/system-tools-backends.conf.dpkg-remove
  48.             fi
  49.         fi
  50.         ;;
  51. esac
  52.  
  53. if dpkg-maintscript-helper supports mv_conffile; then
  54.   dpkg-maintscript-helper mv_conffile /etc/dbus-1/system.d/system-tools-backends.conf \
  55.     /etc/dbus-1/system.d/org.freedesktop.SystemToolsBackends.conf 2.6.0-6.1 -- "$@"
  56. fi
  57.  
  58.  
  59.